//
//  YCUserDefults.m
//  BoBa
//
//  Created by 朱永超 on 2017/4/20.
//  Copyright © 2017年 zyc. All rights reserved.
//

#import "YCUserDefults.h"

@implementation YCUserDefults
+ (void)writeUserDataWithKey:(id)data forKey:(NSString*)key
{
    if (data == nil)
    {
        return;
    }
    
    else
    {
        [[NSUserDefaults standardUserDefaults] setObject:data forKey:key];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
}

//读取用户偏好设置
+ (id)readUserDataWithKey:(NSString*)key
{
    id temp = [[NSUserDefaults standardUserDefaults] objectForKey:key];
    
    if(temp != nil)
    {
        return temp;
    }
    
    return nil;
}

//删除用户偏好设置
+ (void)removeUserDataWithkey:(NSString*)key
{
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
}

@end
